package com.hq.juesuan.service.imp;

import org.eredlab.g4.arm.util.idgenerator.IDHelper;
import org.eredlab.g4.bmf.base.BaseServiceImpl;
import org.eredlab.g4.ccl.datastructure.Dto;
import org.eredlab.g4.ccl.datastructure.impl.BaseDto;

import com.hq.juesuan.services.JueSuanService;

public class JueSuanServiceImp extends BaseServiceImpl implements JueSuanService {

	@Override
	public Dto addJueSuan(Dto adto) {
		Dto d=new BaseDto();
		//用系统的辅助工具类参数一个编号！
		String final_sn=IDHelper.getCodeID();
		adto.put("final_sn", final_sn);
		adto.put("final_date",adto.getAsTimestamp("final_date"));
		this.g4Dao.insert("juesuanDemo.saveJueSuan",adto);
		d.put("final_sn",final_sn);
		return d;
	}

	@Override
	public Dto deleteJueSuan(Dto ddto) {
		Dto d=new BaseDto();
		String strChecked[]=ddto.getAsString("strChecked").split(",");
		for(int i=0;i<strChecked.length;i++)
		{
			ddto.put("final_sn",strChecked[i]);
			this.g4Dao.delete("juesuanDemo.deleteJueSuanByPrjsn", ddto);
		}
		return d;
	}

	@Override
	public Dto updateJueSuan(Dto udto) {
		Dto d=new BaseDto();
		udto.put("final_date",udto.getAsTimestamp("final_date"));
		this.g4Dao.update("juesuanDemo.updateJueSuan", udto);
		return d;
	}

}
